﻿using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.Seeed;

using Skewworks.PicoMax;
using Skewworks.PicoMax.Graphics565;

namespace PicoMaxGadgeteerDemo
{
    public partial class Program
    {
        PicoFont fnt = new PicoFont(Resources.GetBytes(Resources.BinaryResources.sansserif8));
        
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            // Create a Pico Bitmap
            PicoBitmap bmp = new PicoBitmap(128, 128);

            // Fill background green
            bmp.DrawRectangle(Colors565.Green, 0, 0, 128, 128, Colors565.Green);

            // Draw text in black, centered
            bmp.DrawText("Hello World", fnt, Colors565.Black, 0, 128 / 2 - fnt.FontHeight / 2, 128, fnt.FontHeight, true);

            // Flush to OLED
            oledDisplay.FlushRawBitmap(0, 0, (byte)bmp.Width, (byte)bmp.Height, bmp.Pixels);
        }
    }
}
